package controller;

import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.stage.Stage;

import java.io.IOException;

public class MainController {

    //    方法1窗体
    public void onclick1(MouseEvent mouseEvent) throws IOException {
        //        第二界面
        Service.method=0;
        Parent root2 = FXMLLoader.load(getClass().getResource("/controller/StartView.fxml"));
        Stage stage = new Stage();
        stage.setTitle("不做任何处理的哲学家进餐");
        stage.setScene(new Scene(root2));
        stage.show();
    }

    //    方法2窗体
    public void onclick2(MouseEvent mouseEvent) throws IOException {
        //        第二界面
        Service.method=1;
        Parent root2 = FXMLLoader.load(getClass().getResource("/controller/StartView.fxml"));
        Stage stage = new Stage();
        stage.setTitle("一次分配所有筷子");
        stage.setScene(new Scene(root2));
        stage.show();
    }

    //    方法3窗体
    public void onclick3(MouseEvent mouseEvent) throws IOException {
        //        第二界面
        Service.method=2;
        Parent root2 = FXMLLoader.load(getClass().getResource("/controller/StartView.fxml"));
        Stage stage = new Stage();
        stage.setTitle("最多允许4个同时拿左边筷子");
        stage.setScene(new Scene(root2));
        stage.show();
    }

    //    方法4窗体
    public void onclick4(MouseEvent mouseEvent) throws IOException {
        //        第二界面
        Service.method=3;
        Parent root2 = FXMLLoader.load(getClass().getResource("/controller/StartView.fxml"));
        Stage stage = new Stage();
        stage.setTitle("奇数拿左边，偶数拿右边");
        stage.setScene(new Scene(root2));
        stage.show();

    }


}

